import { postForm, get, put, filePost } from '@/utils/request'

// 获取列表
export function getRecords(listQuery) {
  return get('/device/list/page/token', listQuery)
}

export function add(optData) {
  return postForm('/device', optData)
}

export function edit(optData) {
  return put('/device', optData)
}

export function del(ids) {
  return postForm('/device/del/batch', { pkIds: JSON.stringify(ids) })
}

export function gz(deviceId) {
  return put('/device', { deviceId: deviceId, deviceStatus: 3 })
}

export function kzlxg(deviceId) {
  return put('/device', { deviceId: deviceId, deviceStatus: 1 })
}

export function gzxf(deviceId) {
  return put('/device', { deviceId: deviceId, deviceStatus: 1 })
}

export function sj(optData) {
  return postForm('/device/publish/on', optData)
}

export function xj(deviceId) {
  return postForm('/device/publish/down', { deviceId: deviceId })
}

export function rcodeFile(deviceSerial) {
  return filePost('/miniapp/code/gen?deviceSerial=' + deviceSerial)
}

export default { add, edit, del }
